<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>17.3.BOM--定时器-setTimeout()-练习：自动关闭广告</title>
    <style>

    </style>
</head>
<!-- 5秒后自动关闭广告 -->
<!-- 核心思路：5秒之后，把这个广告隐藏起来 -->
<!-- 用定时器setTimeout -->

<body>
    <img src="images/ad.jpg" alt="" class="ad">
</body>

<script>
    window.addEventListener('load', function () {
        var ad = document.querySelector('.ad');
        setTimeout(function () {
            ad.style.display = 'none';
        }, 5000);
    })
</script>

</html>